跳到主要内容

SetTableLook

Specifies the conditional formatting components of the referenced table style (if one exists) which will be applied to the set of table rows with the current table-level property exceptions. A table style can specify up to six different optional conditional formats, for example, different formatting for the first column, which then can be applied or omitted from individual table rows in the parent table.

The default setting is to apply the row and column band formatting, but not the first row, last row, first column, or last column formatting.

Syntax

expression.SetTableLook(isFirstColumn, isFirstRow, isLastColumn, isLastRow, isHorBand, isVerBand);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
isFirstColumnRequiredbooleanSpecifies that the first column conditional formatting will be applied to the table.
isFirstRowRequiredbooleanSpecifies that the first row conditional formatting will be applied to the table.
isLastColumnRequiredbooleanSpecifies that the last column conditional formatting will be applied to the table.
isLastRowRequiredbooleanSpecifies that the last row conditional formatting will be applied to the table.
isHorBandRequiredbooleanSpecifies that the horizontal band conditional formatting will not be applied to the table.
isVerBandRequiredbooleanSpecifies that the vertical band conditional formatting will not be applied to the table.

Returns

This method doesn't return any data.

Example

This example shows how to set table lock.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("We set the table look to override the current table style:");
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
table.SetTableLook(true, true, true, true, true, true);
tableStyle.GetConditionalTableStyle("topLeftCell").GetTableCellPr().SetShd("clear", 255, 111, 61);
doc.Push(table);